<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <!-- <link rel="stylesheet" href="../css/aui.css"> -->
</head>
<style>
    .user_info {
        /* height: 5rem; */
        width: 100%;
        background-color: #2780e8;
        position: relative;
        /* line-height: 5rem; */
        color: #fff;
        padding-bottom: 1rem;
    }

    .user_info .user_tx {
        width: 3rem;
        height: 3rem;
        margin: 0rem 0 1rem 1rem;
        border-radius: 50%;
    }

    .user_info .user_nickname {
        font-size: 0.8rem;
        position: absolute;
        left: 5rem;
        top: 0.7rem;
    }

    .user_info .arrow_right {
        width: 0.45rem;
        height: 0.8rem;
        position: absolute;
        right: 1rem;
        top: 2.1rem;
    }

    .select_setting {
        margin-top: 0.5rem;
        width: 100%;
    }

    .select_setting .select_setting_item {
        background-color: #fff;
        padding: 0 1rem;
        height: 2.3rem;
        line-height: 2.3rem;
    }

    .select_setting .select_setting_item:active {
        background-color: #f5f5f5;
    }

    .select_setting .padding_l {
        width: 100%;
        height: 100%;
        border-bottom: 1px solid #f2f2f2;
        position: relative;
    }

    .select_setting .padding_l .icon {
        width: 1.2rem;
        height: 1.2rem;
    }

    .select_setting .padding_l p {
        font-size: 0.7rem;
        color: #565656;
        position: absolute;
        left: 2rem;
        top: 0;
    }

    .select_setting .padding_l .arrow_right {
        right: 0;
        top: 0.85rem;
        position: absolute;
        width: 0.45rem;
        height: 0.8rem;
    }

    .zhezhao {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        background-color: rgba(0, 0, 0, 0.7);
        z-index: 100;
        text-align: center;
    }

    .zhezhao .zhezhao_main {
        margin: 35% 0 0 2.5rem;
        width: 14rem;
        height: 15.5rem;
        background-color: #fff;
        border-radius: 0.5rem;
        text-align: center;
    }

    .zhezhao .zhezhao_main img {
        width: 5rem;
        height: 5rem;
        margin: 1rem 0 1rem 0;
    }

    .zhezhao .zhezhao_main .title {
        font-size: 0.9rem;
        color: #565656;
        margin-bottom: 1rem;
    }

    .zhezhao .zhezhao_main .subtitle {
        font-size: 0.7rem;
        color: #838383;
        line-height: 1rem;
        margin-bottom: 1rem;
    }

    .zhezhao .zhezhao_main .renzheng_btn {
        background-color: #2780e8;
        width: 11rem;
        height: 2.25rem;
        color: #fff;
        line-height: 2.25rem;
        text-align: center;
        margin-left: 1.5rem;
        border-radius: 0.5rem;
    }

    .tools {
        margin: 1rem 3%;
        width: 94%;
        background-color: #fff;
        border-radius: 1rem;
    }

    .tools .title {
        font-size: 0.8rem;
        padding: 0.5rem 0 0 0.5rem;
    }

    .tools .items {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .tools .items .item {
        width: 25%;
        text-align: center;
        font-size: 0.7rem;
        padding-top: 0.5rem;
    }

    .tools .items .item img {
        width: 1.5rem;
        height: 1.5rem;
    }

    .tools .items .item .name {
        padding: 0.5rem 0;
        font-size: 0.6rem;
    }

    .notice {
        margin: 1rem 4%;
        width: 92%;
        background-color: #fff;
        border-radius: 1rem;
    }

    .notice .item {
        margin: 0 0.8rem;
        height: 2rem;
        line-height: 2rem;
        border-bottom: 1px dashed #ccc;
        font-size: 0.7rem;
    }

    .notice .item:last-child {
        border: 0;
    }

    .notice img {
        width: 0.4rem;
        height: 0.8rem;
        float: right;
        margin: 0.6rem;
    }

    .renzhengs {
        margin: 0 3%;
        width: 94%;
        margin-top: -2rem;
        position: relative;
        z-index: 100;
    }

    .renzheng {
        padding: 0.5rem;
        background-color: #fff;
        border-radius: 0.5rem;
        margin-top: 0.5rem;
    }

    .renzheng .title {
        font-size: 0.8rem;
        color: #d78439;
    }

    .renzheng .subtitle {
        font-size: 0.7rem;
    }

    .renzheng span {
        float: right;
        padding: 0.2rem 0.3rem;
        background-color: #d78439;
        color: #fff;
        font-size: 0.6rem;
        border-radius: 1rem;
        margin-top: -1rem;
    }

    .p_hide {
        width: 12rem;
    }
</style>

<body>
    <div id="app" v-cloak>
        <div class="user_info" v-if="emp" onclick="renzhen_show(1)">
            <img v-if="avatar" :src="avatar" class="user_tx" alt="">
            <img v-else src="../../image/user_avater.png" class="user_tx" alt="">
            <p class="user_nickname p_hide">{{name}}</p>
            <!-- <p class="user_nickname" v-else>医生{{identifier}}</p> -->
            <!-- <img src="../../image/arrow_right.png" class="arrow_right" alt=""> -->
        </div>
        <div class="user_info openwin" v-else data-win="widget://html/login">
            <img src="../../image/user_avater.png" class="user_tx" alt="">
            <p class="user_nickname">请先登录</p>
            <!-- <img src="../../image/arrow_right.png" class="arrow_right" alt=""> -->
        </div>

        <div class="renzhengs" v-if="status == 0 && emp">
            <div class="renzheng">
                <p class="title">您可以进行资质认证</p>
                <span onclick="go_add_userInfo_win()">资质认证</span>
                <p class="subtitle">资质认证通过后可以使用更多功能</p>
            </div>
        </div>
        <!-- <div class="select_setting">
            <div class="select_setting_item" onclick="renzhen_show(2)">
                <div class="padding_l">
                    <img src="../../image/icon_wallet.png" class="icon" alt="">
                    <p>我的收入</p>
                    <img src="../../image/arrow_right.png" class="arrow_right" alt="">
                </div>
            </div>

            <div class="select_setting_item" onclick="renzhen_show(3)">
                <div class="padding_l">
                    <img src="../../image/icon_text.png" class="icon" alt="">
                    <p>购买记录</p>
                    <img src="../../image/arrow_right.png" class="arrow_right" alt="">
                </div>
            </div>

            <div class="select_setting_item" onclick="renzhen_show(4)">
                <div class="padding_l">
                    <img src="../../image/icon_order.png" class="icon" alt="">
                    <p>全部方案</p>
                    <img src="../../image/arrow_right.png" class="arrow_right" alt="">
                </div>
            </div>

            <div class="select_setting_item" onclick="renzhen_show(5)">
                <div class="padding_l">
                    <img src="../../image/icon_order.png" class="icon" alt="">
                    <p>拍方记录</p>
                    <img src="../../image/arrow_right.png" class="arrow_right" alt="">
                </div>
            </div>

            <div class="select_setting_item" onclick="renzhen_show(6)">
                <div class="padding_l">
                    <img src="../../image/icon_file.png" class="icon" alt="">
                    <p>个人医案</p>
                    <img src="../../image/arrow_right.png" class="arrow_right" alt="">
                </div>
            </div>

            <div class="select_setting_item" onclick="renzhen_show(7)">
                <div class="padding_l">
                    <img src="../../image/icon_patient.png" class="icon" alt="">
                    <p>我的患者</p>
                    <img src="../../image/arrow_right.png" class="arrow_right" alt="">
                </div>
            </div>

            <div class="select_setting_item" data-index="1" onclick="renzhen_show(8)">
                <div class="padding_l">
                    <img src="../../image/icon_changyongfang.png" class="icon" alt="">
                    <p>常用方</p>
                    <img src="../../image/arrow_right.png" class="arrow_right" alt="">
                </div>
            </div>

            <div class="select_setting_item openwin" data-win="invite_colleagues_win">
                <div class="padding_l">
                    <img src="../../image/icon_recommend.png" class="icon" alt="">
                    <p>推荐同行</p>
                    <img src="../../image/arrow_right.png" class="arrow_right" alt="">
                </div>
            </div>

            <div class="select_setting_item openwin" data-win="setting_win">
                <div class="padding_l">
                    <img src="../../image/icon_setting.png" class="icon" alt="">
                    <p>设置</p>
                    <img src="../../image/arrow_right.png" class="arrow_right" alt="">
                </div>
            </div>
            <div style="height: 3rem;width: 100%;"></div>
        </div> -->

        <div class="tools">
            <p class="title">收入结算</p>
            <div class="items">
                <div class="item" onclick="renzhen_show(2)">
                    <img src="../../image/ucenter/income.png" alt="">
                    <p class="name">我的收入</p>
                </div>
                <div class="item" onclick="renzhen_show(15)">
                    <img src="../../image/ucenter/bankCard.png" alt="">
                    <p class="name">银行卡</p>
                </div>
            </div>
        </div>

        <div class="tools">
            <p class="title">常用工具</p>
            <div class="items">
                <div class="item" onclick="renzhen_show(14)">
                    <img src="../../image/ucenter/invite.png" alt="">
                    <p class="name">邀请医生</p>
                </div>
                <!-- <div class="item">
                    <img src="../../image/ucenter/callback.png" alt="">
                    <p class="name">快捷回复</p>
                </div> -->
                <!-- <div class="item">
                    <img src="../../image/ucenter/my_card.png" alt="">
                    <p class="name">我的名片</p>
                </div> -->
                <div class="item" onclick="renzhen_show(9)">
                    <img src="../../image/ucenter/qrcode.png" alt="">
                    <p class="name">我的名片</p>
                </div>

                <div class="item" onclick="renzhen_show(10)">
                    <img src="../../image/ucenter/chufang.png" alt="">
                    <p class="name">处方管理</p>
                </div>
                <div class="item" onclick="renzhen_show(11,1)">
                    <img src="../../image/ucenter/always_case.png" alt="">
                    <p class="name">常用方</p>
                </div>
                <!-- <div class="item" onclick="renzhen_show(12,1)">
                    <img src="../../image/ucenter/icon_select_patient.png" alt="">
                    <p class="name">选择开方患者</p>
                </div> -->
            </div>
        </div>

        <div class="notice">
            <div class="item" onclick="renzhen_show(13)">意见反馈 <img src="../../image/arrow_right.png" alt=""></div>
            <div class="item openwin" data-win="widget://html/setting_win">设置 <img src="../../image/arrow_right.png"
                    alt=""></div>
        </div>
    </div>
</body>

</html>
<!-- <script src="../../script/set_root.js"></script> -->
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/zepto.min.js"></script>
<script type="text/javascript" src="../../script/hb.js"></script>
<script type="text/javascript" src="../../script/set_root.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript">
    apiready = function () {
        hb_ready();
        // alert(JSON.stringify($api.getStorage("emp")))
        // 成功登陆时刷新用户数据
        api.addEventListener({
            name: 'login'
        }, function (ret, err) {
            if ($api.getStorage("emp")) {
                app.emp = true
                app.avatar = $api.getStorage("emp").avatar ? IMAGE_HTTP + $api.getStorage("emp").avatar : ""
                app.name = $api.getStorage("emp").name ? $api.getStorage("emp").name : "医生" + $api
                    .getStorage("emp").userId
                get_ajax("doctor/verify/view", {
                    userId: $api.getStorage("emp").userId
                }, function (res, err) {
                    // console.log(JSON.stringify(res))
                    if (res.data == null) {
                        app.status = 0
                        return
                    }
                    if (res.code == 2000 && res.data != null) {
                        if (res.code == 2000 && res.data) {
                            if (res.data.status) {
                                app.status = res.data.status
                            } else {
                                app.status = 0
                            }
                        }
                    }
                })
            }
        });
        if ($api.getStorage("emp")) {
            app.emp = true
            app.avatar = $api.getStorage("emp").avatar ? IMAGE_HTTP + $api.getStorage("emp").avatar : ""
            app.name = $api.getStorage("emp").name ? $api.getStorage("emp").name : "医生" + $api
                .getStorage("emp").userId
            get_ajax("doctor/verify/view", {
                userId: $api.getStorage("emp").userId
            }, function (res, err) {
                // console.log(JSON.stringify(res))
                if (res.code == 2000 && res.data) {
                    if (res.data == null) {
                        app.status = 0
                        return
                    }
                    if (res.code == 2000 && res.data != null) {
                        if (res.data.status) {
                            app.status = res.data.status
                        } else {
                            app.status = 0
                        }
                    }
                }
            })
        }

    }

    var app = new Vue({
        el: "#app",
        data: {
            emp: false,
            avatar: "",
            zhezhao: false,
            identifier: "",
            name: "", // 存在缓存里面的医生姓名
            status: 0, // 是否通过审核，0>未  1>过
        },
    })


    function go_add_userInfo_win() {
        // add_userInfo_win  // 这是原来的路径
        api.openWin({
            name: "doctor_info_win",
            url: "widget://html/doctor/doctor_info_win.html",
        })
    }

    function renzhen_show(index, indexs) {
        if (app.status == 0) {
            toast("您需要先通过认证")
            return
        }
        if (index == 1) {
            api.openWin({
                name: "user_info_win",
                url: "widget://html/user_info_win.html"
            })
        } else if (index == 2) {
            api.openWin({
                name: "my_income_win",
                url: "widget://html/my_income_win.html"
            })
        } else if (index == 3) {
            api.openWin({
                name: "order_list_win",
                url: "widget://html/order_list_win.html"
            })
        } else if (index == 4) {
            api.openWin({
                name: "shopping_history_win",
                url: "widget://html/shopping_history_win.html"
            })
        } else if (index == 5) {
            api.openWin({
                name: "paifang_win",
                url: "widget://html/paifang_win.html"
            })
        } else if (index == 6) {
            api.openWin({
                name: "person_consilia_win",
                url: "widget://html/person_consilia_win.html"
            })
        } else if (index == 7) {
            api.openWin({
                name: "my_patient_win",
                url: "widget://html/my_patient_win.html"
            })
        } else if (index == 8) {
            api.openWin({
                name: "my_always_useing_win",
                url: "widget://html/my_always_useing_win.html"
            })
        } else if (index == 9) {
            api.openWin({
                name: "fuzhen_qrcode_win",
                url: "widget://html/fuzhen_qrcode_win.html"
            })
        } else if (index == 10) {
            api.openWin({
                name: "chufang_manage_win",
                url: "widget://html/chufang_manage_win.html"
            })
        } else if (index == 11) {
            api.openWin({
                name: "my_always_useing_win",
                url: "widget://html/my_always_useing_win.html",
                index: indexs
            })
        } else if (index == 12) {
            api.openWin({
                name: "my_patient_win",
                url: "my_patient_win.html",
                index: indexs
            })
        } else if (index == 13) {
            api.openWin({
                name: "yijian_win",
                url: "widget://html/yijian_win.html",
            })
        } else if (index == 14) {
            api.openWin({
                name: "invite_colleagues_win",
                url: "widget://html/invite_colleagues_win.html"
            })
        } else if (index == 15) {
            api.openWin({
                name: "my_bank_card_win",
                url: "widget://html/my_bank_card_win.html"
            })
        }
    }
</script>
